/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '@/utils/request';
import { message } from 'antd';
import isArray from 'lodash/isArray';

export async function wkdInnList(params: any) {
  return request('/wkd/Blacklist/lists', {
    method: 'POST',
    data: params,
  }).then((res: any) => {
    const { code, data, msg } = res;
    if (code == 0) {
      let list: any[] = data || [];
      if (isArray(list)) {
        list = list.map((item: any, index: number) => ({
          ...item,
          index,
        }));
      }
      return { ...res, data: list };
    } else {
      message.error(msg);
      return {};
    }
  });
}

export async function wkdPullBlack(params: any) {
  return request('/wkd/Blacklist/add', {
    method: 'POST',
    data: params,
  });
}

export async function getBrandList() {
  return request('/wkd/Blacklist/getBrandList', {
    method: 'POST',
  });
}

export async function wkdBlackListDel(params: any) {
  return request('/wkd/Blacklist/del', {
    method: 'POST',
    data: params,
  });
}
